package cn.iocoder.yudao.module.system.dal.mysql.datascope;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.datascope.DataScopeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.datascope.vo.*;

/**
 * 权限范围 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface DataScopeMapper extends BaseMapperX<DataScopeDO> {

    default PageResult<DataScopeDO> selectPage(DataScopePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DataScopeDO>()
                .likeIfPresent(DataScopeDO::getName, reqVO.getName())
                .eqIfPresent(DataScopeDO::getAppCode, reqVO.getAppCode())
                .eqIfPresent(DataScopeDO::getAppEnvCode, reqVO.getAppEnvCode())
                .eqIfPresent(DataScopeDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(DataScopeDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(DataScopeDO::getDataScopeCode, reqVO.getDataScopeCode())
                .orderByDesc(DataScopeDO::getId));
    }

}